package com.joysuch.wwyt.mh.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum PlanCycleType {

    WEEK(0, "周检查"),
    SEASON(1, "季度检查"),
    MONTH(2, "月检查"),
    HALF_YEAR(3, "半年度检查");

    private Integer type;
    private String desc;

    PlanCycleType(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<Integer, PlanCycleType> lookup = new HashMap<>();

    static {
        for (PlanCycleType e : EnumSet.allOf(PlanCycleType.class)) {
            lookup.put(e.type, e);
        }
    }

    public static PlanCycleType find(Integer type) {
        if(null == type){
            return null;
        }
        return lookup.get(type);
    }

}
